fix(shared): preserve MCPError payload on pickle#2478
Open
MukundaKatta wants to merge 2 commits intomodelcontextprotocol:mainfrom
Open
fix(shared): preserve MCPError payload on pickle#2478MukundaKatta wants to merge 2 commits intomodelcontextprotocol:mainfrom
MukundaKatta wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
…ror_data The defensive hasattr/fallback branch was unreachable in practice — every MCPError subclass inherits from_error_data() from the base class, so the exc_type.__new__(...) fallback path never fires. Removing it brings coverage to 100% and keeps the reconstructor to 2 lines. Behavior unchanged: - MCPError pickle round-trip - UrlElicitationRequiredError pickle round-trip (specialized path) - Arbitrary MCPError subclass pickle round-trip All 11 tests/shared/test_exceptions.py tests pass.
Author
|
CI was failing on coverage (99.98% vs required 100%). The gap was from the defensive Simplified the reconstructor to two lines. Behavior is unchanged for all three cases verified locally (MCPError, UrlElicitationRequiredError, and an arbitrary MCPError subclass); the existing 11 tests in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
Local note: pytest is blocked in this desktop environment because the available interpreter bottoms out before the repo's required typing features (ImportError on TypeAlias from Python 3.9).